package cn.lyh.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.util.List;

/**
 * @author lyh
 * @version 1.0
 * @since 2021/4/6
 */
/**
    * 商品三级分类
    */
@Data
@TableName(value = "pms_category")
public class PmsCategory {
    /**
     * 分类id
     */
    @TableId(value = "cat_id", type = IdType.AUTO)
    private Long catId;

    /**
     * 分类名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 父分类id
     */
    @TableField(value = "parent_cid")
    private Long parentCid;

    /**
     * 层级
     */
    @TableField(value = "cat_level")
    private Integer catLevel;

    /**
     * 是否显示[0-不显示，1显示]
     */
    @TableField(value = "show_status")
    @TableLogic(value = "1",delval = "0")
    private Byte showStatus;

    /**
     * 排序
     */
    @TableField(value = "sort")
    private Integer sort;

    /**
     * 图标地址
     */
    @TableField(value = "icon")
    private String icon;

    /**
     * 计量单位
     */
    @TableField(value = "product_unit")
    private String productUnit;

    /**
     * 商品数量
     */
    @TableField(value = "product_count")
    private Integer productCount;

    @TableField(exist = false)
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<PmsCategory> children;

    public static final String COL_CAT_ID = "cat_id";

    public static final String COL_NAME = "name";

    public static final String COL_PARENT_CID = "parent_cid";

    public static final String COL_CAT_LEVEL = "cat_level";

    public static final String COL_SHOW_STATUS = "show_status";

    public static final String COL_SORT = "sort";

    public static final String COL_ICON = "icon";

    public static final String COL_PRODUCT_UNIT = "product_unit";

    public static final String COL_PRODUCT_COUNT = "product_count";
}